package com.jjwxc.jwjskandriod.adapter;

import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import com.jjwxc.jwjskandriod.fragment.CollectFragment;
import com.jjwxc.jwjskandriod.fragment.RecentlyFragment;

public class BookshelfAdapter extends FragmentPagerAdapter {
    FragmentManager mFragmentManager;

    public BookshelfAdapter(FragmentManager fm) {
        super(fm);
        mFragmentManager = fm;
    }

    @Override
    public Fragment getItem(int i) {
        Fragment fragment = null;
        switch (i) {
            case 0:
                fragment = new CollectFragment("1", "2");
                break;
            case 1:
                fragment = new RecentlyFragment("4", "5");
                break;

        }
        assert fragment != null;
        return fragment;
    }

    @Override
    public int getCount() {
        return 2;
    }

    public FragmentManager getFragmentManager() {
        return mFragmentManager;

    }
}

